package top.superflow.core.metadata.id.defaults

import java.util.List

import top.superflow.core.metadata.id.Identifier
import top.superflow.core.metadata.{MetadataElement, OldMetadata}
import top.superflow.core.semantic.SemanticData
import top.superflow.lang.{CollectionUtils, StringUtils}

import scala.collection.JavaConverters._


trait MetadataIdentifier extends Identifier{
  
  
  private def buildKey(metadataElements : List[MetadataElement]) : String = {
    if(CollectionUtils.isEmpty(metadataElements)){
      return StringUtils.EMPTY
    }
    
    val key = new StringBuilder
    for(metadata <- metadataElements.asScala){
      key.append(metadata)
    }
    
    key.toString
  }
  
  protected def calculateKey(metadata : OldMetadata) : String = {
    if(metadata == null){
      return null
    }
    
    if(supportSemantic(metadata)){
      
    }else{
      
    }
    
    null
  }
  
  private def getKeyBySemantics(metadata : OldMetadata) : List[SemanticData] = {
    val supportedSemantics = metadata.getPromisedSemantics
    
    null
  }
  
  private def supportSemantic(metadata : OldMetadata) : Boolean = {
    val supportedSemantics = metadata.getPromisedSemantics
    if(!CollectionUtils.isEmpty(supportedSemantics)){
      return true
    }
    
    false
  }
  
  
}

